<?php
include_once "function.php";

class Lib_Menu{
    
    public function getMenu()
    {
        $result = mysql_query("SELECT * FROM categories");
        if( mysql_num_rows($result) > 0){
            $cats = array();
            
            while($cat = mysql_fetch_assoc($result)){
                $cats_ID[$cat['if']][] = $cat;
                $cats[$cat['parent_id']][$cat['id']] = $cat;
            }
        }
        
        echo build_tree($cats,0);
        
    }
    
}

?>